import { STable } from '@/views/box/components'
import { reject } from 'lodash'
export const listMixin = {
  components: {
    STable
  },
  data () {
    return {
      queryParam: {},
      paginationProps: {
        total: 0,
        showTotal: total => `共有 ${total} 条数据`
      },
    }
  },
  filters: {
    status (type) {
      if (type === 2) {
        return '已退订'
      } else if (type === 1) {
        return '已订阅'
      }
    }
  },
  methods: {
    searchList () {
      this.$refs.table.refresh(true)
    },
    resetList () {
      this.queryParam = {}
      this.$refs.table.refresh(true)
    },
    fetchList (params, getList) {
      return new Promise((resolve, reject) => {
        getList(params).then(res => resolve(res))
      })
    },
    handleEdit (record) {
      this.$refs.detailModal.show(record.id)
    },
  }
}